<?php

use yii\helpers\Html;
use yii\bootstrap\ActiveForm;
use yii\captcha\Captcha;

/* @var $this yii\web\View */
/* @var $form yii\bootstrap\ActiveForm */
/* @var $model app\models\ContactForm */

$this->title = '联系我们';
$this->params['breadcrumbs'][] = $this->title;
?>
<div class="site-contact">
    <?php if (Yii::$app->session->hasFlash('contactFormSubmitted')): ?>

        <div class="alert alert-success">
            感谢你联系我们，我们会尽快联系你！
        </div>

    <?php else: ?>

        <div class="row">
            <?php $form = ActiveForm::begin(['id' => 'contact-form', 'class' => 'form-horizontal']); ?>
            <fieldset>
                <legend class="text-center contact-header">联系我们</legend>

                <div class="form-group">
                    <span class="col-md-1 col-md-offset-2 text-center"><i class="glyphicon glyphicon-user bigicon"></i></span>
                    <div class="col-md-8">
                        <?php echo $form->field($model, 'name')->textInput(['placeholder' => '姓名'])->label(false) ?>
                    </div>
                </div>
                <div class="form-group">
                    <span class="col-md-1 col-md-offset-2 text-center"><i class="glyphicon glyphicon-envelope bigicon"></i></span>
                    <div class="col-md-8">
                        <?php echo $form->field($model, 'email')->textInput(['placeholder' => '邮箱'])->label(false) ?>
                    </div>
                </div>

                <div class="form-group">
                    <span class="col-md-1 col-md-offset-2 text-center"><i class="glyphicon glyphicon-pencil bigicon"></i></span>
                    <div class="col-md-8">
                        <?php echo $form->field($model, 'subject')->textInput(['placeholder' => '标题'])->label(false) ?>
                    </div>
                </div>

                <div class="form-group">
                    <span class="col-md-1 col-md-offset-2 text-center"><i class="glyphicon glyphicon-edit bigicon"></i></span>
                    <div class="col-md-8">
                        <?php echo $form->field($model, 'body')->textArea(['rows' => 6, 'placeholder' => '请填写内容'])->label(false) ?>
                        <?php
                        echo $form->field($model, 'verifyCode')->widget(Captcha::className(), [
                            'template' => '<div class="row"><div class="col-lg-3">{image}</div><div class="col-lg-6">{input}</div></div>',
                        ])
                        ?>
                    </div>
                </div>

                <div class="form-group">
                    <div class="col-md-12 text-center">
                        <?php echo Html::submitButton('提交', ['class' => 'btn btn-primary btn-lg', 'name' => 'contact-button']) ?>
                    </div>
                </div>
            </fieldset>
            <?php ActiveForm::end(); ?>
        </div>

    <?php endif; ?>
</div>






<style>
    .contact-header {
        color: #36A0FF;
        font-size: 27px;
        padding: 10px;
    }

    .bigicon {
        font-size: 35px;
        color: #36A0FF;
    }
</style>